package o;

import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import androidx.annotation.AnyRes;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import androidx.annotation.StyleableRes;
import org.xmlpull.v1.XmlPullParser;

@RestrictTo({d.ॱ})
public class fx {
    public static boolean ˊ(@NonNull XmlPullParser xmlPullParser, @NonNull String str) {
        return xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", str) != null;
    }

    public static float ॱ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, float f) {
        return !ˊ(xmlPullParser, str) ? f : typedArray.getFloat(i, f);
    }

    public static boolean ˏ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, boolean z) {
        return !ˊ(xmlPullParser, str) ? z : typedArray.getBoolean(i, z);
    }

    public static int ˊ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, int i2) {
        return !ˊ(xmlPullParser, str) ? i2 : typedArray.getInt(i, i2);
    }

    @ColorInt
    public static int ˎ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, @ColorInt int i2) {
        return !ˊ(xmlPullParser, str) ? i2 : typedArray.getColor(i, i2);
    }

    public static fr ˏ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @Nullable Theme theme, @NonNull String str, @StyleableRes int i, @ColorInt int i2) {
        if (ˊ(xmlPullParser, str)) {
            TypedValue typedValue = new TypedValue();
            typedArray.getValue(i, typedValue);
            if (typedValue.type >= 28 && typedValue.type <= 31) {
                return fr.ˏ(typedValue.data);
            }
            fr ˎ = fr.ˎ(typedArray.getResources(), typedArray.getResourceId(i, 0), theme);
            if (ˎ != null) {
                return ˎ;
            }
        }
        return fr.ˏ(i2);
    }

    @AnyRes
    public static int ˋ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, @AnyRes int i2) {
        return !ˊ(xmlPullParser, str) ? i2 : typedArray.getResourceId(i, i2);
    }

    @Nullable
    public static String ˏ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i) {
        if (ˊ(xmlPullParser, str)) {
            return typedArray.getString(i);
        }
        return null;
    }

    @Nullable
    public static TypedValue ˊ(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, int i) {
        if (ˊ(xmlPullParser, str)) {
            return typedArray.peekValue(i);
        }
        return null;
    }

    @NonNull
    public static TypedArray ˎ(@NonNull Resources resources, @Nullable Theme theme, @NonNull AttributeSet attributeSet, @NonNull int[] iArr) {
        if (theme == null) {
            return resources.obtainAttributes(attributeSet, iArr);
        }
        return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
    }
}
